/**
* auth: tc.tang 2007-1-31
*/
//function for message function 

refreshHomePageChannel = function(homePageWindow,divName,method){
  
  doMethod = function(){
    if(typeof method=="function"){
	    method();
	  }else{
	    try{
	      eval(method);
	    }catch(e){}
	  }
  }
  
  waitHomePageReadyRefreshed = function(){
    if(!eval("window.opener.channel"+divName+".channelRefreshFlag")){
	  doMethod();
	}else{
	  setTimeout(waitHomePageReadyRefreshed,1000);
	}
  }
  
  if(homePageWindow){
    var parentWindowsDocument = homePageWindow.document;
    var isFromMessageInbox = false;
    if(parentWindowsDocument.getElementById(divName)){
      isFromMessageInbox = true;//From messageInbox
    }
    if(isFromMessageInbox){
      eval("window.opener.channel"+divName+".refreshChannel()");
      waitHomePageReadyRefreshed();
    }else{
     doMethod();
     return false;
    }
  }else{
    doMethod();
    return false;
  }
}

  //this method for alert page know weather it from home page
  checkFromHomePage = function(homePageWindow,divName){
     if(homePageWindow){
       var parentWindowsDocument = homePageWindow.document;
       var isFromMessageInbox = false;
       if(parentWindowsDocument.getElementById(divName)){
         isFromMessageInbox = true;//From messageInbox
        }
        
        return isFromMessageInbox;
     }else{
       return false;
     }
  }
  